package com.situ.car.service.Impl;

import com.situ.car.dao.IReturnDao;
import com.situ.car.dao.Impl.ReturnDaoImpl;
import com.situ.car.pojo.entity.RReturn;
import com.situ.car.pojo.query.ReturnQuery;
import com.situ.car.pojo.vo.ReturnVo;
import com.situ.car.service.IReturnService;
import com.situ.car.util.PageInfo;

import java.util.List;

public class ReturnServiceImpl implements IReturnService {
    private IReturnDao returnDao = new ReturnDaoImpl();
    @Override
    public PageInfo selectByPage(ReturnQuery returnQuery) {
        List<ReturnVo> list = returnDao.selectByPage(returnQuery);
        int totalCount = returnDao.selectTotalCount(returnQuery);
        return PageInfo.ok(totalCount, list);
    }

    @Override
    public void add(RReturn rReturn) {
        returnDao.add(rReturn);
    }

    @Override
    public void deleteById(Integer id) {
        returnDao.deleteById(id);
    }

    @Override
    public void deleteAll(String[] ids) {
        for (String id : ids) {
            returnDao.deleteById(Integer.parseInt(id));
        }
    }

    @Override
    public ReturnVo selectById(Integer id) {
        return returnDao.selectById(id);
    }

    @Override
    public void update(RReturn rReturn) {
        returnDao.update(rReturn);
    }
}
